package com.yangjun.common.enums.report;

import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public enum OutstockTypeEnum {
	self_outstock("自主出库",0),third_outstock("厂家代发",1);
	
	private String name;
	private Integer id;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	private OutstockTypeEnum(String name, Integer id) {
		this.name = name;
		this.id = id;
	}
	
	public static String getOutstockTypeName(int id){
		String name = null;
		for(OutstockTypeEnum outstockTypeEnum : OutstockTypeEnum.values()){
			if(outstockTypeEnum.id==id){
				name = outstockTypeEnum.getName();
			}
		}
		return name;
	}
	public static String getOutstockTypeId(String name){
		String id = null;
		for(OutstockTypeEnum outstockTypeEnum : OutstockTypeEnum.values()){
			if(outstockTypeEnum.name.equals(name)){
				id = outstockTypeEnum.getId().toString();
			}
		}
		return id;
	}
	public static List<Map<String,String>>  getOutstockTypeMap(){
		List<Map<String,String>> resultList = Lists.newArrayList();
		for(OutstockTypeEnum outstockTypeEnum : OutstockTypeEnum.values()){
			Map<String,String> itemMap = Maps.newHashMap();
			itemMap.put("name", outstockTypeEnum.getName());
			itemMap.put("value", String.valueOf(outstockTypeEnum.getId()));
			resultList.add(itemMap);
		}
		return resultList;
	}
	public static List<String>  getOutstockName(){
		List<String> resultList = Lists.newArrayList();
		for(OutstockTypeEnum outstockTypeEnum : OutstockTypeEnum.values()){
			resultList.add(outstockTypeEnum.getName());
		}
		return resultList;
	}
	
}
